home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / generic / mathimpl.h < prev    next >
C/C++ Source or Header  |  1993-05-15  |  4KB  |  129 lines

  1. /* This part here added by roland@prep.ai.mit.edu for the GNU C library.  */
  2.    
  3. #include <math.h>        /* Done first so we can #undef.  */
  4. #include <endian.h>
  5. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  6. #undef national
  7. #define national
  8. #endif
  9.  
  10. #undef    isinf
  11. #define    isinf    __isinf
  12. #undef    isnan
  13. #define    isnan    __isnan
  14. #undef    infnan
  15. #define    infnan    __infnan
  16. #undef    copysign
  17. #define    copysign    __copysign
  18. #undef    scalb
  19. #define    scalb    __scalb
  20. #undef    drem
  21. #define    drem    __drem
  22. #undef    logb
  23. #define    logb    __logb
  24. #undef    __finite
  25. #undef    finite
  26. #define    finite    __finite
  27. #undef    expm1
  28. #define    expm1    __expm1
  29.  
  30. #define    exp__E    __exp__E
  31. #define    log__L    __log__L
  32.  
  33.  
  34. /*
  35.  * Copyright (c) 1988 The Regents of the University of California.
  36.  * All rights reserved.
  37.  *
  38.  * Redistribution and use in source and binary forms, with or without
  39.  * modification, are permitted provided that the following conditions
  40.  * are met:
  41.  * 1. Redistributions of source code must retain the above copyright
  42.  *    notice, this list of conditions and the following disclaimer.
  43.  * 2. Redistributions in binary form must reproduce the above copyright
  44.  *    notice, this list of conditions and the following disclaimer in the
  45.  *    documentation and/or other materials provided with the distribution.
  46.  * 3. All advertising materials mentioning features or use of this software
  47.  *    must display the following acknowledgement:
  48.  *    This product includes software developed by the University of
  49.  *    California, Berkeley and its contributors.
  50.  * 4. Neither the name of the University nor the names of its contributors
  51.  *    may be used to endorse or promote products derived from this software
  52.  *    without specific prior written permission.
  53.  *
  54.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  55.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  56.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  57.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  58.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  59.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  60.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  61.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  62.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  63.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  64.  * SUCH DAMAGE.
  65.  *
  66.  *    @(#)mathimpl.h    5.4 (Berkeley) 3/5/91
  67.  */
  68.  
  69. #include <sys/cdefs.h>
  70. #include <math.h>
  71.  
  72. #if defined(vax)||defined(tahoe)
  73.  
  74. /* Deal with different ways to concatenate in cpp */
  75. #  ifdef __STDC__
  76. #    define    cat3(a,b,c) a ## b ## c
  77. #  else
  78. #    define    cat3(a,b,c) a/**/b/**/c
  79. #  endif
  80.  
  81. /* Deal with vax/tahoe byte order issues */
  82. #  ifdef vax
  83. #    define    cat3t(a,b,c) cat3(a,b,c)
  84. #  else
  85. #    define    cat3t(a,b,c) cat3(a,c,b)
  86. #  endif
  87.  
  88. #  define vccast(name) (*(const double *)(cat3(name,,x)))
  89.  
  90.    /*
  91.     * Define a constant to high precision on a Vax or Tahoe.
  92.     *
  93.     * Args are the name to define, the decimal floating point value,
  94.     * four 16-bit chunks of the float value in hex
  95.     * (because the vax and tahoe differ in float format!), the power
  96.     * of 2 of the hex-float exponent, and the hex-float mantissa.
  97.     * Most of these arguments are not used at compile time; they are
  98.     * used in a post-check to make sure the constants were compiled
  99.     * correctly.
  100.     *
  101.     * People who want to use the constant will have to do their own
  102.     *     #define foo vccast(foo)
  103.     * since CPP cannot do this for them from inside another macro (sigh).
  104.     * We define "vccast" if this needs doing.
  105.     */
  106. #  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
  107.     static const long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)};
  108.  
  109. #  define ic(name, value, bexp, xval) ;
  110.  
  111. #else    /* vax or tahoe */
  112.  
  113.    /* Hooray, we have an IEEE machine */
  114. #  undef vccast
  115. #  define vc(name, value, x1,x2,x3,x4, bexp, xval) ;
  116.  
  117. #  define ic(name, value, bexp, xval) \
  118.     static const double name = value;
  119.  
  120. #endif    /* defined(vax)||defined(tahoe) */
  121.  
  122.  
  123. /*
  124.  * Functions internal to the math package, yet not static.
  125.  */
  126. extern double    exp__E();
  127. extern double    log__L();
  128.  
  129.